package com.inspur.jzsxxzx.service.catalog.impl;

import com.inspur.jzsxxzx.entity.catalog.DataBasicElemCatalogItem;
import com.inspur.jzsxxzx.mapper.catalog.DataBasicElemCatalogItemMapper;
import com.inspur.jzsxxzx.service.catalog.DataBasicElemCatalogItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DataBasicElemCatalogItemServiceImpl implements DataBasicElemCatalogItemService {
    
    @Autowired
    private DataBasicElemCatalogItemMapper dataBasicElemCatalogItemMapper;
    
    @Override
    public int save(DataBasicElemCatalogItem record) {
        return dataBasicElemCatalogItemMapper.insert(record);
    }
    
    @Override
    public DataBasicElemCatalogItem findById(String cataId, String columnCode, Integer cataVersion) {
        return dataBasicElemCatalogItemMapper.selectByPrimaryKey(cataId, columnCode, cataVersion);
    }
    
    @Override
    public int update(DataBasicElemCatalogItem record) {
        return dataBasicElemCatalogItemMapper.updateByPrimaryKey(record);
    }
    
    @Override
    public int deleteById(String cataId, String columnCode, Integer cataVersion) {
        return dataBasicElemCatalogItemMapper.deleteByPrimaryKey(cataId, columnCode, cataVersion);
    }
    
    @Override
    public List<DataBasicElemCatalogItem> findAll() {
        return dataBasicElemCatalogItemMapper.selectAll();
    }
    
    @Override
    public List<DataBasicElemCatalogItem> findByCataId(String cataId, Integer cataVersion) {
        return dataBasicElemCatalogItemMapper.selectByCataId(cataId, cataVersion);
    }
    
    @Override
    public List<DataBasicElemCatalogItem> findByCondition(DataBasicElemCatalogItem condition) {
        return dataBasicElemCatalogItemMapper.selectByCondition(condition);
    }
    
    @Override
    public List<DataBasicElemCatalogItem> findByPage(DataBasicElemCatalogItem condition, int pageNum, int pageSize) {
        int offset = (pageNum - 1) * pageSize;
        return dataBasicElemCatalogItemMapper.selectByPage(condition, offset, pageSize);
    }
    
    @Override
    public int countByCondition(DataBasicElemCatalogItem condition) {
        return dataBasicElemCatalogItemMapper.countByCondition(condition);
    }
}